package cb.tools;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.net.URL;

import org.jhotdraw.draw.RectangleFigure;
import org.jhotdraw.draw.TransformEdit;
import org.jhotdraw.util.ResourceBundleUtil;

import cb.images.Stream;

public class GroundFigure extends RectangleFigure
	{
		public GroundFigure()
		{
			super();
			ResourceBundleUtil labels = ResourceBundleUtil.getLAFBundle("cb.properties.Labels");
			
			
		}
	
@Override
 public void basicSetBounds(Point2D.Double anchor, Point2D.Double lead) {
        rectangle.x = Math.min(anchor.x, lead.x);
        rectangle.y = Math.min(anchor.y , lead.y);
        rectangle.width = 40;
        rectangle.height = 40;
    }
		@Override
		protected void drawFill(Graphics2D g)
			{

				Image img;

				URL myurl = Stream.class.getResource("gnd.png");
				Toolkit tk = Toolkit.getDefaultToolkit();
				img = tk.getImage(myurl);
				
				
				
			g.drawImage(img, (int) this.getStartPoint().x+1, (int) this.getStartPoint().y+1, (int)this.getBounds().height, (int)this.getBounds().width,
						null);
				
			
				
				
				
				
				
//				
//				Graphics2D graphics2D = (Graphics2D)g;
//	            graphics2D.rotate(Math.toRadians(45));
//	            graphics2D.setColor(Color.red);
//	            graphics2D.fillRect(50, 50, 150, 150);
//	             
//	            //rotate about 100, 100
//	            graphics2D = (Graphics2D)g.create();
//	            graphics2D.rotate(Math.toRadians(45), 100, 100);
//	            graphics2D.setColor(Color.blue);
//	            graphics2D.fillRect(50, 50, 150, 150);
//	             
	            //dispose Graphics2D object
//	            graphics2D.dispose();

			}
	}
